import java.util.Scanner;

public class text01 {
    public static void main(String[] args) {

        System.out.println("请输入一个1~1000的整数：");
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b, c, d, e, sum;
        b = a / 1000;
        c = a / 100 % 10;
        d = a / 10 % 10;
        e = a % 10;
        sum = b + c + d + e;
        System.out.println("结果为：" + sum);
    }
}
